/*
 * @Copyright: 2016 www.yyfax.com Inc. All rights reserved.
 */
package com.yyfax.pay.common.exception;

import com.yyfax.framework.yyfax.enums.RspCodeEnum;

/**
 * 自定义支付异常
 * 
 * @author buyi
 * @date 2017-04-11 10:00:04
 * @since v1.0.0
 */
@SuppressWarnings("serial")
public class YYPayException extends RuntimeException {

	protected int code;
	protected String message;
	protected String display;

	/**
	 * 构造函数
	 */
	public YYPayException() {
		super();
	}

	public YYPayException(RspCodeEnum code) {
		this(code, "");
		this.display = code.getDisplay();
	}

	/**
	 * 构造函数
	 * 
	 * @param code
	 * @param message
	 */
	public YYPayException(RspCodeEnum code, String message) {
		super();
		this.code = Integer.valueOf(code.getValue());
		this.display = code.getDisplay();
		this.message = message;
	}

	/**
	 * 构造函数
	 * 
	 * @param code
	 * @param message异常详细信息
	 * @param display 前端展示内容，用于展示给用户
	 */
	public YYPayException(RspCodeEnum code, String message, String display) {
		super();
		this.code = Integer.valueOf(code.getValue());
		this.display = display;
		this.message = message;
	}

	public YYPayException(int code) {
		super();
		this.code = code;
	}

	public YYPayException(int code, String message) {
		super();
		this.code = code;
		this.message = message;
	}

	public YYPayException(int code, String message, String display) {
		super();
		this.code = code;
		this.message = message;
		this.display = display;
	}

	/**
	 * 构造函数
	 * 
	 * @param message
	 * @param cause
	 * @param enableSuppression
	 * @param writableStackTrace
	 */
	public YYPayException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
		super(message, cause, enableSuppression, writableStackTrace);
	}

	/**
	 * 构造函数
	 * 
	 * @param message
	 * @param cause
	 */
	public YYPayException(String message, Throwable cause) {
		super(message, cause);
	}

	/**
	 * 构造函数
	 * 
	 * @param message
	 */
	public YYPayException(String message) {
		super(message);
	}

	/**
	 * 构造函数
	 * 
	 * @param cause
	 */
	public YYPayException(Throwable cause) {
		super(cause);
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	@Override
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getDisplay() {
		return display;
	}

	public void setDisplay(String display) {
		this.display = display;
	}
}
